package com.bwie.parkdemo.adapter;

import android.support.annotation.NonNull;
import android.util.Log;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bwie.lib_core.imgload.BasicImageLoader;
import com.bwie.parkdemo.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.io.File;

/**
 * 车辆照片适配器
 *
 * */
public class CarImgAdapter extends BaseQuickAdapter<Object, BaseViewHolder> {

    public static final int TYPE = 2;

    public CarImgAdapter() {
        super(R.layout.item_carimg);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Object item) {
        String path = (String) item;
        Log.e("ZXY","CarImgAdapter:"+path);
        if (path.equals("+")){
            helper.setImageResource(R.id.item_car_img,R.drawable.add);
        }else {
            Glide.with(helper.itemView.getContext()).load(new File(path)).into((ImageView) helper.getView(R.id.item_car_img));
//            new BasicImageLoader.BasicBuilder().setUrl(path).setImg((ImageView) helper.getView(R.id.item_car_img))
//                    .build();
        }
    }

}
